var e = require;
var t = module;
var o = exports;
var n;
Object.defineProperty(o, "__esModule", {value: !0});
var r = e("AdUtils"),
    s = cc._decorator,
    c = s.ccclass,
    l =
        (s.property,
        (function (e) {
            function t() {
                var t = e.call(this) || this;
                return (
                    (t._nativeCurrentAd = null),
                    (t._nativeAd = null),
                    (t._ready = !1),
                    (t.enterGmae = !1),
                    (t._utils = r.default.instance),
                    t
                );
            }
            return (
                __extends(t, e),
                (t.prototype.start = function () {}),
                (t.prototype.initAd = function (e, t) {
                    var o = e.navite_ad_code;
                    this._utils.log("------创建native广告posId： " + o),
                        (this._nativeAd = qg.createNativeAd({posId: o})),
                        (this.enterGmae = !1);
                    var n = this;
                    this._nativeAd
                        ? (this._nativeAd.load(),
                          this._utils.log("------创建native广告-this.nativeAd.load()： " + this._nativeAd),
                          this._nativeAd.onLoad(function (e) {
                              (n.enterGmae = !0),
                                  n._utils.log("原生广告加载完成-onload触发 " + JSON.stringify(e)),
                                  e && e.adList && ((n._nativeCurrentAd = e.adList.pop()), (n._ready = !0), t && t(!0));
                          }),
                          this._nativeAd.onError(function (e) {
                              n._utils.log("原生广告加载异常" + JSON.stringify(e)),
                                  (n.enterGmae = !0),
                                  e && (e.errCode, t && t(!1));
                          }))
                        : ((n.enterGmae = !0), t && t(!1)),
                        this.scheduleOnce(function () {
                            n.enterGmae || (t && t(!1));
                        }, 5);
                }),
                (t.prototype.reportAdShow = function () {
                    this._nativeAd &&
                        this._nativeCurrentAd &&
                        this._nativeAd.reportAdShow({adId: this._nativeCurrentAd.adId.toString()});
                }),
                (t.prototype.reportAdClick = function () {
                    this._nativeAd &&
                        this._nativeCurrentAd &&
                        this._nativeAd.reportAdClick({adId: this._nativeCurrentAd.adId.toString()});
                }),
                (t.prototype.getNativeDate = function () {
                    return this._nativeCurrentAd;
                }),
                (t.prototype.isReady = function () {
                    return this._ready;
                }),
                __decorate([c], t)
            );
        })(cc.Component));
o.default = l;
